/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.unl.asd.tablas;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableCellRenderer;

/**
 *
  */
public class Tabla_Disenio_Celda implements TableCellRenderer {

    JTextField texto;

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        texto = new JTextField(value.toString());
        texto.setFont(new java.awt.Font("SansSerif", 0, 14));
        texto.setVisible(true);
        texto.setEditable(false);

        if (row % 2 == 0) {
            texto.setBackground(new Color(126, 205, 99));
            if (isSelected == true) {
                texto.setBackground(new Color(141, 179, 204));
            }

        } else {
            texto.setBackground(new Color(155, 219, 171));
            if (isSelected == true) {
                texto.setBackground(new Color(141, 179, 204));
            }

        }
        return texto;
    }

    /**
     * 
     * @return
     */
    public JTextField getTexto() {
        return texto;
    }

    /**
     * 
     * @param texto
     */
    public void setTexto(JTextField texto) {
        this.texto = texto;
    }
}
